import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import styleImport from "vite-plugin-style-import"


// https://vitejs.dev/config/
export default defineConfig({
  base:"/",
  publicDir:"/src/assets",
  
  plugins: [
    vue(),
    styleImport({
      libs: [{
        libraryName: 'element-plus',
        esModule: true,
        ensureStyleFile: true,
        resolveStyle: (name) => {
          name = name.slice(3)
          return `element-plus/packages/theme-chalk/src/${name}.scss`;
        },
        resolveComponent: (name) => {
          return `element-plus/lib/${name}`;
        },
      }]
    })
  ],
  
  server:{
    port:8080,
    proxy:{
      '/api':{
        target:'http://localhost:3000/',
        changeOrigin:true,
      },
      '/test':{
        target:'http://localhost:3000',
        changeOrigin:true,
      },
      '/user':{
        target:'http://localhost:3000',
        changeOrigin:true,
      },
      '/file':{
        target:'http://localhost:3000',
        changeOrigin:true,
      },
      '/pictures':{
        target:'http://localhost:3000',
        changeOrigin:true,
      },
    }
  }
})
